#ifndef HUISU_H
#define HUISU_H

#include<iostream>
#include<bits/stdc++.h>
// #include<map>
// #include<set>
// #include<vector>
#include <algorithm>
#include <thread>   // sleep_for
#include <chrono>
#include "maze_generator.h"
using namespace std;


struct Point {
    int x, y;

    bool operator==(const Point& other) const {
        return x == other.x && y == other.y;
    }

    bool operator<(const Point& other) const {
        return tie(x, y) < tie(other.x, other.y);
    }
};


struct Step {
    Point pos;
    double score;
    int cost;
    double valuePerStep;
    bool if_twist;
    Point twist_to;
};

class huisu
{
private:
    map<Point, double> resourceMap;
    set<Point> visited;
    vector<Point> path;
    vector<Step> candidates;
    vector<vector<char>> mazec;
    bool hasResource ;
    Point exit;
    int n;
    int score;
    vector<Point> path_to_exit;
public:
    huisu(int n);
    void generate_rp(const vector<vector<GameElement>>& maze);
    void getVisionOptions(Point player);
    void greedyCollect(Point start);
    void set_resource(int x,int y,double val);
    int bfs(Point start, Point target);
    bool inBounds(int x, int y);
    const int getScore();
    const vector<Point> getPath();
    void printMazeWithPath(Point currentStep);
    void visit_trans(vector<vector<bool>> visited_ext);
    void after_greedy_findexit(Point current);
    int bfs_toexit(Point start, Point target);
    ~huisu();
};

#endif // HUISU_H
